package info.bond.rp.experiments;

/**
 * @author Andrey Bondarenko
 * 
 * Pair of values needed for generator - maximum possible index for dimension 
 * and current dimension index parameter. 
 */
public class DimensionSizeIndexPair {
	
	private Integer dimensionParameterIndex;
	private Integer maxDimensionParameterIndex; // dimension size
	
	// Constructor
	public DimensionSizeIndexPair(Integer maxValueIndex, Integer valueIndex) {
		super();
		this.maxDimensionParameterIndex = maxValueIndex;
		this.dimensionParameterIndex = valueIndex;
	}
	
	public DimensionSizeIndexPair(Integer maxValueIndex) {
		this(maxValueIndex, 0);
	}
	// Business methods
	public Boolean isLastIndex() {
		return dimensionParameterIndex.equals(maxDimensionParameterIndex - 1);
	}
	public void increaseIndex() {
		if (isLastIndex()) {
			throw new IllegalArgumentException("Cannot increase index, because it is last!");
		}
		dimensionParameterIndex++;
	}
	/**
	 * Sets <code>dimensionParameterIndex</code> to <code>0</code>;
	 */
	public void resetIndex() {
		dimensionParameterIndex = 0;
	}
	// Getters/Setters
	public Integer getDimensionParameterIndex() {
		return dimensionParameterIndex;
	}
	public void setDimensionParameterIndex(Integer index) {
		this.dimensionParameterIndex = index;
	}
	public Integer getMaxDimensionParameterIndex() {
		return maxDimensionParameterIndex;
	}
	public void setMaxDimensionParameterIndex(Integer maxDimensionParameterIndex) {
		this.maxDimensionParameterIndex = maxDimensionParameterIndex;
	}
}
